package com.slz3.business.module.wmsManagement.wmsStockDetail.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.wmsManagement.wmsStockDetail.domain.WmsStockDetail;
import com.slz3.business.module.wmsManagement.wmsStockDetail.domain.WmsStockDetailFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class WmsStockDetailTransactionalServiceImpl implements WmsStockDetailTransactionalService {

    @Override
    public WmsStockDetail modify(WmsStockDetail wmsStockDetailNew) {
        Repositorys.wmsStockDetail.test();
        Repositorys.wmsStockDetail.save(WmsStockDetailFactory.initBaseFields());
        System.err.println(1 / 0);
        wmsStockDetailNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.wmsStockDetail.saveAndFlush(wmsStockDetailNew);
    }

    @Override
    public List<WmsStockDetail> batchModify(List<WmsStockDetail> wmsStockDetailList) {
        return Repositorys.wmsStockDetail.saveAll(wmsStockDetailList);
    }
}
